﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace LowLevelGraphics.ImageFormats
{
    /// <summary>
    /// Txt
    /// </summary>
    public class Txt : AbstractImageFormat, IImageFormat
    {
        private static Font m_Font = new Font("Arial", 10);
        /// <summary>
        /// Creates the specified _s file name.
        /// </summary>
        /// <param name="_sFileName">Name of the _s file.</param>
        /// <returns></returns>
        public static UnsafeBitmap Create(string _sFileName)
        {
            string sText = System.IO.File.ReadAllText(_sFileName);
            Bitmap bitmap = new Bitmap(1024, 768);
            Graphics g = Graphics.FromImage(bitmap);
            g.FillRectangle(Brushes.White, new Rectangle(0, 0, 1024, 768));
            g.DrawString(sText, m_Font, Brushes.Black, new Point(0, 0));
            return new UnsafeBitmap(bitmap);
        }

        /// <summary>
        /// Gets or sets Font
        /// </summary>
        public Font Font
        {
            get { return m_Font; }
            set { m_Font = value; }
        }

        /// <summary>
        /// returns Extension
        /// </summary>
        public override string Extension
        {
            get { return "txt"; }
        }

        /// <summary>
        /// Save
        /// </summary>
        /// <param name="_sFileName"></param>
        /// <returns></returns>
        public override bool Save(string _sFileName)
        {
            return false;
        }
    }
}
